<?php
//require_once (MLEngine . 'MakiFactory/MakiFactory.php');


class ActionsDealer {
	CONST NUMBER = 0;
	CONST STRING = 1;

	function action($action, $maki) {
		$factory = MakiFactory::getMakisubfactory ( MakiFactory::MYSQL );
		$metodo = "get" . get_class ( $maki ) . "Maki";
		//valida metodos pasador por la url que hagan daño :)
		if(method_exists($maki,$action)){
			return $factory->$metodo ()->$action ( $maki );
		}

		return $factory->$metodo ()->buscar ($maki);

	}

	function prepareRequest($request_array, $value, $type) {

		switch ($type) {
			case 0 :
				$output = - 1;
			default :
				$output = null;
		}

		return (empty ( $request_array [$value] ) ? $output : $request_array [$value]);
	}
}

?>